-> root -> programming -> ::programming::bash
Everything related to writing bash scripts.
Notes on this page:

grep matching too much, or behaving unpredictably (well, in a strange way)
[34]

At least twice in my life I've been surprised by grep either not matching what it was supposed to, or matching too much.

Both times it turned out to be a problem with the locale configured on the system. Yes, locale settings influence things like what are to be considered whitespaces, letters, and so on. grep and many other matching libraries keep that in consideration, and change behavior accordingly.

While this is kind of expected, if the locale configuration is screwed for the language being used, grep (and many other tools...) may really get confused.

Check the locale configurations, and try with things like:
     LC_ALL=C grep ...
   
to see if the problem goes away or grep changes behavior. If it does change, well... you know for sure the problem is with the locales. Good luck with the debugging :)

Debugging unix domain sockets
[38]

Ever found yourself trying to debug an application that relies on unix sockets as the way of communication? Well, a tool that often comes handy is "socat". Socat is a bit like netcat, but supports all sorts of connection styles, socket types, and so on. Try things like:
   socat STDIN UNIX-CONNECT:/tmp/unix-socket
 
socat is great, it has libreadline support (history and so on) and allows to set / change almost every parameter of any socket types. Have a peek in its man page. It is also useful from bash scripts, if you want to do any kind of connection handling. But... you'd probably better off with a real programming language if that's what you want to do. Stop abusing your shell.
Generated by CRON on 2012/02/14 at 06:26:35.